package com.bifang.module.file.dao.service.impl;

import com.bifang.module.file.common.vo.EmPowerFileVO;
import com.bifang.module.file.dao.service.FileInfoService;
import com.bifang.module.file.dao.model.FileInfo;
import com.bifang.module.file.dao.mapper.FileInfoMapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.stereotype.Service;

import java.math.BigDecimal;
import java.util.Date;
import java.util.List;

/**
 * 文件信息表 服务实现类
 *
 * @author chenzh
 * @since 2021-01-27
 */
@Service
public class FileInfoServiceImpl extends ServiceImpl<FileInfoMapper, FileInfo>
        implements FileInfoService {
    @Override
    public List<FileInfo> getEmpowerFile(EmPowerFileVO emPowerFileVO) {
        emPowerFileVO.setNow(new Date());
        return baseMapper.getEmpowerFile(emPowerFileVO);
    }

    @Override
    public void saveOther(FileInfo fileInfo) {
        baseMapper.saveOther(fileInfo);
    }

    @Override
    public FileInfo getOtherByShowId(String showId) {
        int i=showId.indexOf("]");
        String tableName=showId.substring(1,i);
        return baseMapper.getOtherByShowId(showId,tableName);
    }

    @Override
    public void deleteOtherByFileId(BigDecimal fileId, String tableName) {
         baseMapper.deleteOtherByFileId(fileId,tableName);
    }

}
